<%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Administration.Modules.OrdersControl"
    CodeBehind="Orders.ascx.cs" %>
<%@ Register TagPrefix="nopCommerce" TagName="ToolTipLabel" Src="ToolTipLabelControl.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="SimpleTextBox" Src="SimpleTextBox.ascx" %>
<div class="section-header">
    <div class="title">
        <img src="Common/ico-sales.png" alt="Orders" />
        Orders
    </div>
    <div class="options">
        <asp:Button ID="SearchButton" runat="server" Text="Search" CssClass="adminButtonBlue"
            OnClick="SearchButton_Click" ToolTip="Search for orders based on the criteria below" />
        <asp:Button runat="server" Text="Export to XML" CssClass="adminButtonBlue" ID="btnExportXML"
            OnClick="btnExportXML_Click" ValidationGroup="ExportXML" ToolTip="Export orders list to a xml file" />
    </div>
</div>
<table width="100%">
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblStartDate" Text="Start date:" ToolTip="The start date for the search in Coordinated Universal Time (UTC)."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:TextBox runat="server" ID="txtStartDate" />
            <asp:ImageButton runat="Server" ID="iStartDate" ImageUrl="~/images/Calendar_scheduleHS.png"
                AlternateText="Click to show calendar" /><br />
            <ajaxToolkit:CalendarExtender ID="cStartDateButtonExtender" runat="server" TargetControlID="txtStartDate"
                PopupButtonID="iStartDate" />
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblEndDate" Text="End date:" ToolTip="The end date for the search in Coordinated Universal Time (UTC)."
                ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:TextBox runat="server" ID="txtEndDate" />
            <asp:ImageButton runat="Server" ID="iEndDate" ImageUrl="~/images/Calendar_scheduleHS.png"
                AlternateText="Click to show calendar" /><br />
            <ajaxToolkit:CalendarExtender ID="cEndDateButtonExtender" runat="server" TargetControlID="txtEndDate"
                PopupButtonID="iEndDate" />
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblCustomerEmail" Text="Customer email address:"
                ToolTip="A customer email address." ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:TextBox ID="txtCustomerEmail" CssClass="adminInput" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblOrderStatus" Text="Order status:"
                ToolTip="Search by a specific order status e.g. Complete." ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:DropDownList ID="ddlOrderStatus" runat="server" CssClass="adminInput">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblPaymentStatus" Text="Payment status:"
                ToolTip="Search by a specific payment status e.g. Paid." ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <asp:DropDownList ID="ddlPaymentStatus" runat="server" CssClass="adminInput">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            <nopCommerce:ToolTipLabel runat="server" ID="lblGoDirectlyToOrderNumber" Text="Go directly to order #:"
                ToolTip="Go directly to order #" ToolTipImage="~/Administration/Common/ico-help.gif" />
        </td>
        <td class="adminData">
            <nopCommerce:SimpleTextBox runat="server" CssClass="adminInput" ID="txtOrderID" Width="100px"
                ValidationGroup="GoDirectly" ErrorMessage="Order number is required"></nopCommerce:SimpleTextBox>
            </asp:TextBox><asp:Button runat="server" Text="Go" CssClass="adminButtonBlue" ID="btnGoDirectlyToOrderNumber"
                OnClick="btnGoDirectlyToOrderNumber_Click" ValidationGroup="GoDirectly" ToolTip="Go directly to order #" />
        </td>
    </tr>
</table>
<p>
</p>
<asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="False" Width="100%"
    OnPageIndexChanging="gvOrders_PageIndexChanging" AllowPaging="true" PageSize="15">
    <Columns>
        <asp:BoundField DataField="OrderID" HeaderText="Order ID" ItemStyle-Width="10%">
        </asp:BoundField>
        <asp:TemplateField HeaderText="Order total" ItemStyle-Width="10%">
            <ItemTemplate>
                <%#Server.HtmlEncode(PriceHelper.FormatPrice(Convert.ToDecimal(Eval("OrderTotal")), true, false))%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Order Status" ItemStyle-Width="10%">
            <ItemTemplate>
                <%#OrderManager.GetOrderStatusName(Convert.ToInt32(Eval("OrderStatusID")))%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Payment Status" ItemStyle-Width="20%">
            <ItemTemplate>
                <%#PaymentStatusManager.GetPaymentStatusName(Convert.ToInt32(Eval("PaymentStatusID")))%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Shipping Status" ItemStyle-Width="15%">
            <ItemTemplate>
                <%#ShippingStatusManager.GetShippingStatusName(Convert.ToInt32(Eval("ShippingStatusID")))%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Customer" ItemStyle-Width="15%">
            <ItemTemplate>
                <%#GetCustomerInfo (Convert.ToInt32(Eval("CustomerID")))%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="View" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%"
            ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <a href="OrderDetails.aspx?OrderID=<%#Eval("OrderID")%>" title="View order details">
                    View </a>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Created on" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%"
            ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <%#DateTimeHelper.ConvertToUserTime((DateTime)Eval("CreatedOn")).ToString()%>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<br />
<asp:Label runat="server" ID="lblTotalSales"></asp:Label>
<br />
<asp:Label runat="server" ID="lblNoOrdersFound" Text="No orders found" Visible="false"></asp:Label>